/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-05-10
 * Time: 14:32
 */
class Money implements Cloneable{
    public int m;
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Student implements Cloneable {
    public String name;
    public int age;
    public Money money = new Money();
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Student tmp = (Student) super.clone();
        tmp.money = (Money) this.money.clone();
        return tmp;
    }
    public void run() {
        System.out.println(name+"正在跑！");
    }
}
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Student student1 = new Student();
        student1.money.m = 99;
        Student student2 = (Student) student1.clone();
        student2.money.m = 100;
        System.out.println(student1.money.m);
        System.out.println(student2.money.m);
    }
}
